package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	var digit_num = 0
	var char_num = 0
	var other_num = 0

	file, err := os.Open("test.dat")
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	defer file.Close()

	reader := bufio.NewReader(file)
	for {
		line, error := reader.ReadString('\n')
		if error == io.EOF {
			break
		}
		for _, val := range line {
			if val >= '0' && val <= '9' {
				digit_num++
			} else if (val >= 'A' && val <= 'Z') || (val >= 'a' && val <= 'z') {
				char_num++
			} else {
				other_num++
			}
		}
	}
	fmt.Println("num is ", digit_num)
	fmt.Println("char is ", char_num)
	fmt.Println("other is ", other_num)
}
